﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Model.CommonModel.PageModel
{
    public class PagedInfo<T>
    {
        public int PageSize { get; set; } = 10;
        public int PageIndex { get; set; } = 1;
        public int TotalCount { get; set; }

        public int TotalPage { get; set; }

        public List<T> Data { get; set; }

        public PagedInfo()
        {
        }

        public PagedInfo(List<T> source, int pageIndex, int pageSize)
        {
            PageIndex = pageIndex;
            PageSize = pageSize;
            TotalCount = source.Count;
            TotalPage = (int)Math.Ceiling(TotalCount / (double)PageSize);
        }
    }
}
